class Solution:
    def movesToStamp(self, stamp: str, target: str) -> List[int]:
        M, N = len(stamp), len(target)
        target = list(target)
        result = []
        changed = True
        
        def can_stamp(pos):
            changed = False
            for i in range(M):
                if target[pos+i] != '?' and target[pos+i] != stamp[i]:
                    return False
            for i in range(M):
                if target[pos+i] != '?':
                    changed = True
                    target[pos+i] = '?'
            return changed
        
        while changed:
            changed = False
            for i in range(N - M + 1):
                if can_stamp(i):
                    changed = True
                    result.append(i)
                    if all(c == '?' for c in target):
                        return result[::-1]
        
        return []